#include "CEMoveBySpeed.h"

CEMoveBySpeed::CEMoveBySpeed()
{
}

CEMoveBySpeed::~CEMoveBySpeed()
{
}

bool CEMoveBySpeed::initWithSpeed(float speed, const CCPoint& deltaPosition){
	float distance = ccpDistance(ccp(0, 0), deltaPosition);
	float duration = distance/speed;
	return initWithDuration(duration, deltaPosition);
}

CEMoveBySpeed* CEMoveBySpeed::create(float speed, const CCPoint& deltaPosition){
	CEMoveBySpeed *pRet = new CEMoveBySpeed();
	pRet->initWithSpeed(speed, deltaPosition);
	pRet->autorelease();

	return pRet;
}